GET /api/admin/v1/coupons
List of Coupons

Request headers

Only registered user can perform this action
  Authentication - string - required
    Example of Authentication header : "Bearer TOKEN_FETCHED_FROM_SERVER_DURING_REGISTRATION"

Success response body

{
  "coupons": [
    {
      "id": 1,
      "name": "dsa2",
      "percent_off": 10.0,
      "created_at": "2022-08-16T16:00:04.482Z",
      "stripe_id": "7Ot6KyLe"
    },
    ...
  ],
  "meta": {
    "total_count": 7
  }
}

Params

Param name Description
sort_to
optional

Validations:

  • Must be one of: asc, desc.

sort_by
optional

Validations:

  • Must be one of: id, name, percent_off, created_at.

page
optional

Validations:

  • Must be a Integer


GET /api/admin/v1/coupons/:id
Show Coupon

Request headers

Only registered user can perform this action
  Authentication - string - required
    Example of Authentication header : "Bearer TOKEN_FETCHED_FROM_SERVER_DURING_REGISTRATION"

Success response body

{
  "id": 1,
  "name": "dsa2",
  "percent_off": 10.0,
  "created_at": "2022-08-16T16:00:04.482Z",
  "stripe_id": "7Ot6KyLe"
}

Params

Param name Description
id
required

Validations:

  • Must be a Integer


POST /api/admin/v1/coupons
Create coupon

Request headers

Only registered user can perform this action
  Authentication - string - required
    Example of Authentication header : "Bearer TOKEN_FETCHED_FROM_SERVER_DURING_REGISTRATION"

Success response body

{
  "id": 1,
  "name": "dsa2",
  "percent_off": 10.0,
  "created_at": "2022-08-16T16:00:04.482Z",
  "stripe_id": "7Ot6KyLe"
}

Params

Param name Description
name
required

Validations:

  • Must be a String

stripe_id
required

Validations:

  • Must be a String


PUT /api/admin/v1/coupons/:id
Update coupon

Request headers

Only registered user can perform this action
  Authentication - string - required
    Example of Authentication header : "Bearer TOKEN_FETCHED_FROM_SERVER_DURING_REGISTRATION"

Success response body

{
  "id": 1,
  "name": "dsa2",
  "percent_off": 10.0,
  "created_at": "2022-08-16T16:00:04.482Z",
  "stripe_id": "7Ot6KyLe"
}

Params

Param name Description
id
required

Validations:

  • Must be a Integer

coupon
required

Validations:

  • Must be a Hash

coupon[name]
required

Validations:

  • Must be a String

coupon[stripe_id]
required

Validations:

  • Must be a String


DELETE /api/admin/v1/coupons/:id
Delete coupon

Request headers

Only registered user can perform this action
  Authentication - string - required
    Example of Authentication header : "Bearer TOKEN_FETCHED_FROM_SERVER_DURING_REGISTRATION"

Success response body

{
  "success": true
}

Params

Param name Description
id
required

Validations:

  • Must be a Integer